﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Text;
using DotNet.Business;
using DotNet.Model;
using DotNet.Common;
using System.Threading;
using System.Collections.Generic;
public partial class Admin_AddUser : basePage
{
   
    adminBll aBll = new adminBll();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["state"] != null)
            {
                SaveAdmin();    
            }
        }
    }

    private void SaveAdmin()
    {
        if (Request.Form["adminUser"].ToString().Trim() == "" || Request.Form["adminPwd"].ToString().Trim() == "" || aBll.Exists(Request.Form["adminUser"].ToString().Trim()))
        {
            Response.Write("必填信息不完整或则有人已经注册了该账户");
            Response.End();
        }
        admin admin = new admin();
        admin.adminDate = DateTime.Now;
        admin.adminEmail = Request.Form["adminEmail"].ToString();
        admin.adminMark = Request.Form["adminMark"].ToString();
        admin.adminName = Request.Form["adminName"].ToString();
        admin.adminPwd = CommUtil.DotEnCrypt(Request.Form["adminPwd"].ToString(), 24);
        admin.adminQQ = Request.Form["qq"].ToString();
        admin.adminSex = Request.Form["sex"].ToString();
        admin.adminState = false;
        admin.adminTel = Request.Form["tel"].ToString();
        admin.adminUser = Request.Form["adminUser"];
        if (aBll.Insert(admin))
        {
            Response.Write("1");
            Response.End();
        }
     
       
    }
  
}
